package im.elephas.androfan.common.widget;

import im.elephas.androfan.activity.AndroFanActivity;
import im.elephas.androfan.common.ApiCaller;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;

public abstract class GeneralWidget {

	protected ViewGroup parentView;
	protected View widgetView;

	protected AndroFanActivity mActivity;
	protected ApiCaller mApiCaller;

	public GeneralWidget(ViewGroup parentView, AndroFanActivity mActivity) {
		this.parentView = parentView;
		this.mActivity = mActivity;
		this.mApiCaller = mActivity.getApiCaller();
	}

	public Activity getActivity() {
		return mActivity;
	}

	public void addToParentView() {
		parentView.addView(widgetView);
	}

	public void setInvisible() {
		widgetView.setVisibility(View.GONE);
	}

	public ViewGroup getParentView() {
		return parentView;
	}

	public void setParentView(ViewGroup parentView) {
		this.parentView = parentView;
	}

	public View getWidgetView() {
		return widgetView;
	}

	public void setWidgetView(View widgetView) {
		this.widgetView = widgetView;
	}

	public ApiCaller getApiCaller() {
		return mApiCaller;
	}
}
